package com.sdy.web;


import com.alibaba.fastjson.JSONObject;
import com.sdy.po.OrderItem;
import com.sdy.service.OrderItemSercive;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/orderItem")
public class OrderItemController {

    @Autowired
    OrderItemSercive orderItemSercive;

    @ResponseBody
    @RequestMapping("/ListByOrderId")
    public JSONObject getListByOrderId(){
        JSONObject jsonObject = new JSONObject();
        List<OrderItem> orderItemList = orderItemSercive.getListByOrderId(1);
        jsonObject.put("data",orderItemList);
        for (OrderItem or: orderItemList) {
            System.out.println(or.toString());
        }
        return jsonObject;
    }
}
